﻿package mortal.game.view.flowerSend
{
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.flowerSend.data.*;
    import mortal.mvc.core.*;

    public class FlowerSendSuccessBox extends GSprite
    {
        protected var _data:FlowerSendData;
        private var _name:GTextFiled;
        private var _result:GTextFiled;
        private var _sendBtn:GLoadingButton;
        private var _flowerIcon:GImageBitmap;

        public function FlowerSendSuccessBox()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.FlowerTxt_3, 0, 0, this));
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.FlowerTxtBg, 0, 30, this));
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.FlowerTxt_4, 0, 65, this));
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.FlowerTxtBg, 0, 90, this));
            var _loc_1:* = GlobalStyle.textFormatBai;
            this._name = UIFactory.gTextField("", 2, 33, 200, 20, this, _loc_1);
            this._result = UIFactory.gTextField("", 2, 93, 200, 20, this, GlobalStyle.textFormatHuang2);
            this._sendBtn = UIFactory.gLoadingButton(ResFileConst.FlowerSendAgainBtn, 70, 150, 84, 73, this);
            this._sendBtn.drawNow();
            this._sendBtn.configEventListener(MouseEvent.CLICK, this.sendFlower);
            this._flowerIcon = UIFactory.gImageBitmap("", -65, 195, this);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._name.dispose(param1);
            this._name = null;
            this._result.dispose(param1);
            this._result = null;
            this._sendBtn.dispose(param1);
            this._sendBtn = null;
            this._flowerIcon.dispose(param1);
            this._flowerIcon = null;
            this._data = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function sendFlower(event:MouseEvent) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.FlowerOpenWin, this._data));
            return;
        }// end function

        public function set data(param1:FlowerSendData) : void
        {
            this._data = param1;
            this._flowerIcon.imgUrl = "FlowerType_" + this._data.itemData.itemInfo.type + "_" + this._data.itemData.itemInfo.itemLevel;
            this._name.htmlText = this._data.toPlayer.name + " " + ItemsUtil.getItemWholeName(this._data.itemData, true, 1, true);
            this._result.text = Language.getString(35300) + this._data.itemData.itemInfo.effect;
            return;
        }// end function

    }
}
